//
//  QLNavigationController.m
//  WorkAssistant
//
//  Created by Shrek on 15/6/3.
//  Copyright (c) 2015年 com.homelife.manager.mobile. All rights reserved.
//

#import "QLNavigationController.h"

@interface QLNavigationController ()

@end

@implementation QLNavigationController

+ (void)initialize {
    UINavigationBar *barAppearce = [UINavigationBar appearance];
    
    // Bar
    [barAppearce setBarTintColor:[UIColor lightGrayColor]];
    [barAppearce setTranslucent:YES];
    
    // Text
    [barAppearce setTintColor:[UIColor whiteColor]];
    
    // Title
    [barAppearce setTitleTextAttributes:@{NSForegroundColorAttributeName: [UIColor whiteColor]}];
    
    // BackImage
    [barAppearce setBackIndicatorImage:[UIImage imageNamed:@"back"]];
    [barAppearce setBackIndicatorTransitionMaskImage:[UIImage imageNamed:@"back"]];
    
    // BarButtonItem
    UIBarButtonItem *barButtonItem = [UIBarButtonItem appearanceWhenContainedIn:[QLNavigationController class], nil];
    [barButtonItem setTitleTextAttributes:@{NSForegroundColorAttributeName: [UIColor whiteColor]} forState:UIControlStateNormal];
    [barButtonItem setTitleTextAttributes:@{NSForegroundColorAttributeName: [UIColor lightGrayColor]} forState:UIControlStateDisabled];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    [self loadDefaultSetting];
}

/** Load the default UI elements And prepare some datas needed. */
- (void)loadDefaultSetting {
    
}



- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated {
    self.visibleViewController.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonItemStylePlain target:nil action:nil];
    [super pushViewController:viewController animated:animated];
}

- (void)backAction {
    [self popViewControllerAnimated:YES];
}

@end
